import { request } from "@umijs/max";

/**
 * 获取设备列表
 * @param params
 * @returns
 */
export function get_device_list(
  params: Types.Device.IDeviceSearch
): Promise<Types.Http.Response<Types.Device.IDeviceList>> {
  return request("/api/v1/admin/device/list", { params });
}

/**
 * 新增设备
 * @param data
 * @returns
 */
export function add_device<T>(data: Types.Device.IDeviceInfo): Promise<Types.Http.Response<T>> {
  return request("/api/v1/admin/device/create", { data, method: "post" });
}

/**
 * 获取设备详情
 * @param params
 * @returns
 */
export function get_device_detail(
  id: string
): Promise<Types.Http.Response<Types.Device.IDeviceInfo>> {
  return request("/api/v1/admin/device/detail/" + id);
}

/**
 * 编辑 设备
 * @param data
 * @returns
 */
export function edit_device(data: Types.Device.IDeviceInfo): Promise<Types.Http.Response<null>> {
  return request("/api/v1/admin/device/edit", { data, method: "post" });
}

/**
 * 删除 设备
 * @param data
 * @returns
 */
export function delete_device(id: string): Promise<Types.Http.Response<null>> {
  return request("/api/v1/admin/device/delete/" + id);
}
